import axios from 'axios'

// Create axios instance
const instance = axios.create({
  baseURL: 'http://192.168.2.4:8070', // Replace with your API base URL
  timeout: 5000,
  headers: {
    'Content-Type': 'application/json'
  }
})

// Add request interceptor
instance.interceptors.request.use(
  config => {
    // Do something before request is sent
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// Add response interceptor  
instance.interceptors.response.use(
  response => {
    // Do something with response data
    return response.data.data
  },
  error => {
    return Promise.reject(error)
  }
)

export default instance
